﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BtnOK_Click(object sender, EventArgs e)
    {
        string AllString = this.TxtString.Text.Trim().ToString();
        string str = this.TxtS.Text.Trim().ToString();
        //使用IndexOf方法定位字符及子串
        int i = AllString.IndexOf(str);
        this.lblResult.Text = "该字符在字符串中的位置为：" + i ;
    }
}
